package com.rongcheng.frc.android_ui_study.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.rongcheng.frc.android_ui_study.R;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by frc on 16-5-25.
 */
public class FirstRecyclerViewAdapter extends RecyclerView.Adapter<FirstRecyclerViewHolder> {
    private List<String> items;


    public FirstRecyclerViewAdapter(List<String> dateItems) {

        this.items = (dateItems != null ? dateItems : new ArrayList<String>());
    }

    @Override
    public FirstRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_my_first_recycler_view, parent, false);

        return new FirstRecyclerViewHolder(itemView);
    }

    @Override
    public void onBindViewHolder(FirstRecyclerViewHolder holder, int position) {

        holder.textView.setText(items.get(position));

    }

    @Override
    public int getItemCount() {
        return (this.items != null) ? this.items.size() : 0;
    }
}
